package Test;

@FunctionalInterface
interface NoReturnNoParam
{
    void method();
}

@FunctionalInterface
interface NoReturnOneParam
{
    void method(int i);
}

@FunctionalInterface
interface Way
{
    int method(int i);
}

public class TestLambda
{
    public static int doubleNumber(int i)
    {
        return 2 * i;
    }
    
    public int multiplyNumber(int j)
    {
        return j * 3;
    }
    
    public static void main (String[] args)
    {
//        String name = "chen";
//        int age = 21;
//
//        NoReturnNoParam noReturnNoParam = () ->
//            System.out.println("没返回值没参数");
//        noReturnNoParam.method();
//
//        NoReturnOneParam noReturnOneParam = a ->
//            System.out.println("没返回值一个参数: " + a);
//
//        noReturnOneParam.method(age);
    
        int i = 5;
        
        Way wayStatic = TestLambda :: doubleNumber;
        System.out.println(wayStatic.method(i));
        
        TestLambda testLambda = new TestLambda();
        
        Way wayNoneStatic = testLambda :: multiplyNumber;
        System.out.println(wayNoneStatic.method(i));
    }
}
